package lenovo.asd.xml;

import java.io.InputStream;
import java.util.List;

import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;

public class SAXTaskService {
	
	public static List<Task> readXml(InputStream inStream) throws Exception {
		SAXParserFactory spf = SAXParserFactory.newInstance();
		SAXParser saxParser = spf.newSAXParser();
		XMLContentHandler handler = new XMLContentHandler();

		saxParser.parse(inStream, handler);
		inStream.close();
		return handler.getTasks();

	}

}
